﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO;

namespace Brainfuck_interpreter
{
    class InterpretorBrainfuck : Interpret
    {
        List<char> Prog;

        public InterpretorBrainfuck() :
            base()
        {
            Load_Dicktionnaire();
        }

        public void Ecrire()
        {
            Console.WriteLine();
        }

        public void Lire()
        {
            Console.ReadLine();
        }

        public void Load_Dicktionnaire()
        {
            Table['.'] = new ExecInstr(Lire);
            Table[','] = new ExecInstr(Ecrire);
        }

        public override int Load_file(string filename)
        {   
            StreamReader r = new StreamReader(filename);

            while (r != null)
            {
                Prog.Add(Convert.ToChar(r.Read()));
            }

            r.Close();

            return Prog.Capacity;
        }
    }
}
